/****** Object:  Table [DW].[fPurchaseCreditMemo]    Script Date: 28/04/2022 09:44:27 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fPurchaseCreditMemo]') AND type in (N'U'))
DROP TABLE [DW].[fPurchaseCreditMemo]
GO


CREATE TABLE [DW].[fPurchaseCreditMemo](
	[CompanyPrefix] [nvarchar](200) NULL,
	[OrderNumberAndLineKey] [varchar](200) NULL,
	[SK_Vendor] [int] NULL,
	[SK_Item] [int] NULL,
	[SK_Location] [int] NULL,
	[SK_ReturnReason] [int] NULL,
	[Credit Memo Posting Date] [datetime] NULL,
	[Purchase Credit Memo Create Date] [datetime] NULL,
	[Posting Date] [datetime] NULL,
	[Order Number] [varchar](20) NULL,
	[Order Line No] [int] NULL,
	[Quantity Credited_] [decimal](38, 20) NULL,
	[Status] [int] NULL,
	[Batchdate] [datetime] NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [DW].[fPurchaseInvoice]    Script Date: 28/04/2022 09:44:41 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fPurchaseInvoice]') AND type in (N'U'))
DROP TABLE [DW].[fPurchaseInvoice]
GO

CREATE TABLE [DW].[fPurchaseInvoice](
	[CompanyPrefix] [nvarchar](200) NULL,
	[OrderNumberAndLineKey] [varchar](200) NULL,
	[SK_Vendor] [int] NULL,
	[SK_Item] [int] NULL,
	[SK_Location] [int] NULL,
	[Invoice Posting Date] [datetime] NULL,
	[Purchase Invoice Create Date] [datetime] NULL,
	[Order Number] [varchar](20) NULL,
	[Order Line No] [int] NULL,
	[Quantity Invoiced_] [decimal](38, 20) NULL,
	[Status] [int] NULL,
	[Batchdate] [datetime] NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [DW].[fPurchaseOrders]    Script Date: 28/04/2022 09:45:00 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fPurchaseOrders]') AND type in (N'U'))
DROP TABLE [DW].[fPurchaseOrders]
GO


CREATE TABLE [DW].[fPurchaseOrders](
	[CompanyPrefix] [nvarchar](200) NULL,
	[OrderNumberAndLineKey] [varchar](200) NULL,
	[SK_Vendor] [int] NULL,
	[SK_Item] [int] NULL,
	[SK_Location] [int] NULL,
	[Document Date] [datetime] NULL,
	[Order Date] [datetime] NULL,
	[Invoice Due Date] [datetime] NULL,
	[Expected Receipt Date] [datetime] NULL,
	[Planned Receipt Date] [datetime] NULL,
	[Purchase Create Date] [date] NULL,
	[Posting Date] [datetime] NULL,
	[Promised Receipt Date] [datetime] NULL,
	[Requested Receipt Date] [datetime] NULL,
	[Assigned User ID] [nvarchar](50) NULL,
	[Order Number] [varchar](50) NULL,
	[Order Line No] [int] NULL,
	[Qty per Unit of Measure] [decimal](38, 20) NULL,
	[Quantity_] [decimal](38, 20) NULL,
	[Quantity (Base)_] [decimal](38, 20) NULL,
	[Status] [varchar](50) NOT NULL,
	[Unit of Measure] [nvarchar](50) NULL,
	[Unit Cost (LCY)] [decimal](38, 20) NULL,
	[Batchdate] [datetime] NOT NULL,
	[Order on Backlog] [varchar](50) NOT NULL,
	[On Time] [varchar](50) NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [DW].[fPurchaseReceipts]    Script Date: 28/04/2022 09:45:21 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fPurchaseReceipts]') AND type in (N'U'))
DROP TABLE [DW].[fPurchaseReceipts]
GO

CREATE TABLE [DW].[fPurchaseReceipts](
	[CompanyPrefix] [nvarchar](200) NULL,
	[OrderNumberAndLineKey] [varchar](200) NULL,
	[SK_Vendor] [int] NULL,
	[SK_Item] [int] NULL,
	[SK_Location] [int] NULL,
	[Expected Receipt Date] [datetime] NULL,
	[Planned Receipt Date] [datetime] NULL,
	[Receipt Posting Date] [datetime] NULL,
	[Purchase Receipt Create Date] [datetime] NULL,
	[Promised Receipt Date] [datetime] NULL,
	[Requested Receipt Date] [datetime] NULL,
	[Order Number] [varchar](50) NULL,
	[Order Line No] [int] NULL,
	[Quantity Receipt_] [decimal](38, 20) NULL,
	[Status] [int] NULL,
	[Batchdate] [datetime] NOT NULL
) ON [PRIMARY]
GO




